home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / vmmstat.lha / VMMStat / RCS / VMM_Stat.h < prev    next >
C/C++ Source or Header  |  1995-07-25  |  3KB  |  130 lines

  1. head    1.1;
  2. access;
  3. symbols;
  4. locks; strict;
  5. comment    @ * @;
  6.  
  7.  
  8. 1.1
  9. date    95.07.25.11.33.38;    author enderle;    state Exp;
  10. branches;
  11. next    ;
  12.  
  13.  
  14. desc
  15. @VMM standard header file
  16. @
  17.  
  18.  
  19. 1.1
  20. log
  21. @Initial revision
  22. @
  23. text
  24. @#ifndef VMM_STAT_H
  25. #define VMM_STAT_H
  26.  
  27. #include <exec/types.h>
  28. #include <exec/tasks.h>
  29. #include <exec/ports.h>
  30.  
  31. /**********************************************************************/
  32. /*    Getting statistics messages from VMM for further processing     */
  33. /**********************************************************************/
  34.  
  35. struct VMStatMsg
  36.   {
  37.   struct Message VMMessage;   /* don't forget to put sizeof (struct VMStatMsg) */
  38.                               /* into mn_Length. Future version of VMM might   */
  39.                               /* extend this structure */
  40.   struct Task   *Sender;      
  41.   UWORD          Command;
  42.   UWORD          ReplySignal;
  43.   ULONG          VMSize;
  44.   ULONG          VMFree;
  45.   ULONG          Faults;
  46.   ULONG          PagesWritten;
  47.   ULONG          PagesRead;
  48.   ULONG          NumFrames;
  49.   ULONG          PagesUsed;
  50.   ULONG          PageSize;
  51.   ULONG          TrapStructsFree;
  52.   };
  53.  
  54. #define VMCMD_AskStat 1472
  55.  
  56. /* Do the following to get a statistics message from VMM:
  57.  * 
  58.  * struct VMStatMsg *StatMsg;
  59.  * LONG   VMSignal;
  60.  * struct MsgPort *VMPort;
  61.  *
  62.  * if ((StatMsg = AllocMem (sizeof (struct VMStatMsg), MEMF_PUBLIC)) == NULL)
  63.  *   Cleanup ();
  64.  *
  65.  * if ((VMSignal = AllocSignal (-1L)) == -1L)
  66.  *   Cleanup ();
  67.  *
  68.  * StatMsg->VMMessage.mn_Length = sizeof (struct VMStatMsg);
  69.  * StatMsg->Sender      = FindTask (NULL);
  70.  * StatMsg->Command     = VMCMD_AskStat;
  71.  * StatMsg->ReplySignal = VMSignal;
  72.  *
  73.  * Forbid ();
  74.  * if ((VMPort = FindPort ("VMM_Port")) != NULL)
  75.  *   PutMsg (VMPort, (struct Message*)StatMsg);
  76.  * else
  77.  *   ....
  78.  *
  79.  * Permit ();
  80.  * 
  81.  * Wait (1L << VMSignal);
  82.  *
  83.  * When this returns the StatMsg will contain the necessary parameters.
  84.  * Do whatever you like with it.
  85.  *
  86.  * Cleanup ();
  87.  *
  88.  * Easy, isn't it?
  89.  */
  90.  
  91. /**********************************************************************/
  92. /*                Getting VM usage statistics from VMM                */
  93. /**********************************************************************/
  94.  
  95. /* Send the following message structure to 'VMM_Port' just as a few lines
  96.  * above.
  97.  */
  98.  
  99. struct VMUsageMsg
  100.   {
  101.   struct Message VMMessage;   /* don't forget to put sizeof (struct VMStatMsg) */
  102.                               /* into mn_Length. Future version of VMM might   */
  103.                               /* extend this structure */
  104.   struct Task   *Sender;      
  105.   UWORD          Command;
  106.   UWORD          ReplySignal;
  107.   struct List   *TaskList;
  108.   };
  109.  
  110. /* Use this for the Command value */
  111.  
  112. #define VMCMD_AskVMUsage                1481
  113.  
  114. /* As soon as this returns, 'TaskList' will have been filled in. 
  115.  * 'TaskList' is a list of 'struct TaskVMUsage' described below.
  116.  * You can do whatever you like with the list, but as soon as you are
  117.  * finished you should call FreeMem for every 'struct TaskVMUsage'
  118.  * with a size of 'FreeSize' and for the List structure.
  119.  */
  120.  
  121. struct TaskVMUsage
  122.   {
  123.   struct Node vu_Node;
  124.   LONG   VMInUse;
  125.   ULONG  FreeSize;
  126.   };
  127.  
  128. #endif
  129. @
  130.